from BNL import BNL
def SFS(len1, len2, dataArray):
    """
    Improved SFS algorithm to find the unique sequence with shortest length of 0s and 1s
    :param len1: length of the first sequence
    :param len2: length of the second sequence
    :param dataArray: 2D array of data
    :return: list of indices of the unique sequence with shortest length of 0s and 1s
    """
    # Initialize an empty list to store the result
    result = []
    # Append 0 to the list
    result.append(0)
    # Iterate through the length of the first list
    for i in range(1, len1):
        # Set a variable to determine whether the list is unique
        unique = True
        # Iterate through the list
        for j in result:
            # Set a variable to count the number of elements in the list
            count = 0
            # Iterate through the length of the second list
            for k in range(len2):
                # If the element in the first list is less than the element in the second list
                if dataArray[i][k] <= dataArray[j][k]:
                    # Increment the count
                    count += 1
            # If the count is equal to the length of the second list
            if count == len2:
                # Set the variable to False
                unique = False
                # Break out of the loop
                break
        # If the list is unique
        if unique:
            # Append the index of the first list to the list
            result.append(i)
    # Return the list
    output = [dataArray[i] for i in result]
    return BNL(len(output), len2, output)